﻿using System;
using System.Collections.Generic;

namespace Toth.WLW.Plugins
{

	/// <summary>
	/// Local class for storing a copy of information about a Windows LiveWriter configured Blog
	/// </summary>
	[Serializable()]
	public class Blog
	{

		#region Fields
		
		private List<string> _targetBlogIds;

		#endregion

		#region Properties

		/// <summary>
		/// The ID of a Windows LiveWriter blog
		/// </summary>
		public string Id { get; set; }
		/// <summary>
		/// The Name of a Windows LiveWriter blog
		/// </summary>
		public string Name { get; set; }
		/// <summary>
		/// The HomePageUrl of a Windows LiveWriter blog
		/// </summary>
		public string HomePageUrl { get; set; }
		/// <summary>
		/// A list of any target blog ids the user has set as defaults for this blog
		/// </summary>
		public List<string> TargetBlogIds
		{
			get
			{
				if (_targetBlogIds == null)
				{
					_targetBlogIds = new List<string>();
				}
				return _targetBlogIds;
			}
			set
			{
				_targetBlogIds = value;
			}
		}

		#endregion

		#region Constructors
		
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="id">The id of the LiveWriter blog</param>
		/// <param name="name">The name of the LiveWriter blog</param>
		/// <param name="homePageUrl">The home page url of the LiveWriter blog</param>
		public Blog(string id, string name, string homePageUrl)
		{
			Id = id;
			Name = name;
			HomePageUrl = homePageUrl;
		}

		#endregion

		#region Methods
		
		/// <summary>
		/// Returns the name of the blog
		/// </summary>
		/// <returns></returns>
		public override string ToString()
		{
			return Name;
		}

		#endregion

	}

}
